#!/bin/bash

set -e

if [[ "${is_minimal}" = "true" ]]; then
    return 0
elif [[ "${is_ghost}" = "true" ]]; then
    return 0
fi

sed -i "/^deb cdrom:/s/^/#/" /etc/apt/sources.list

### TODO v10pro only
DISTRIB_RELEASE=$(grep -r PRETTY_NAME= /etc/os-release)
DISTRIB_RELEASE=${DISTRIB_RELEASE#*=}

case ${DISTRIB_RELEASE} in
    '"Lingmo OS 2.0.0 (Hydrogen)"')
        echo "
deb http://packages.lingmo.org/lingmo hydrogen main non-free non-free-firmware" >/etc/apt/sources.list
        ;;
    '"Lingmo OS 3.0.0 (Helium)"')
        echo "
deb http://packages.lingmo.org/lingmo helium main non-free non-free-firmware
" >/etc/apt/sources.list
        ;;
    *)
	rm -f /etc/apt/sources.list.d/lingmo.list ||true
        echo "
deb http://packages.lingmo.org/lingmo hydrogen main non-free non-free-firmware
" >/etc/apt/sources.list
        ;;
esac
